<template>
	<view class="like-list">
		<u-navbar title-color="#000" :isBack="true" back-icon-color="#000" height="60" title="收到的赞"></u-navbar>
		<mescroll-body @init="mescrollInit" :down="{use:false}" @up="upCallback">
			<block v-for="like in likeList">
				<body-item :likeItem="like"></body-item>
			</block>
		</mescroll-body>
	</view>
</template>

<script>
	import bodyItem from '../../../components/body-item.vue';
	export default {
		components: {
			bodyItem
		},
		data() {
			return {
				likeList: []
			};
		},
		methods: {
			downCallback(mescroll) {
				mescroll.resetUpScroll()
			},
			upCallback(mescroll) {
				this.$api.getLikeList({
					page: mescroll.num,
					limit: mescroll.size
				}).then(res => {
					if (res.code) {
						if (mescroll.num == 1) {
							this.likeList = res.data
						} else {
							this.likeList = this.likeList.concat(res.data)
						}
						mescroll.endSuccess(res.data.length, res.data.length >= mescroll.size);
					}
				}).catch(() => {
					mescroll.endErr();
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
		min-height: 100vh;
	}
</style>
